From 6527d112086795c42912abfb5ad20fee68db295d Mon Sep 17 00:00:00 2001 From: Massimo Valentini Date: Fri, 4 May 2012 19:04:03 +0200 Subject: [PATCH] babl: initialize 'palette' babl-format member otherwise non-palette formats could be mistakenly used as palette --- babl/babl-format.c | 1 + tests/palette.c | 1 + 2 files changed, 2 insertions(+) diff --git a/babl/babl-format.c b/babl/babl-format.c index 0a7a840..6fc0a9c 100644 --- a/babl/babl-format.c +++ b/babl/babl-format.c @@ -115,6 +115,7 @@ format_new (const char *name, babl->format.visited = 0; babl->format.image_template = NULL; babl->format.format_n = 0; + babl->format.palette = 0; return babl; } diff --git a/tests/palette.c b/tests/palette.c index aaf98c8..8519262 100644 --- a/tests/palette.c +++ b/tests/palette.c @@ -29,6 +29,7 @@ main (int argc, { int OK = 1; babl_init (); + OK = ! babl_format_is_palette (babl_format_n (babl_type ("double"), 3)); if(1){ unsigned char in[][1] = {{ 0},{ 1},{ 2},{15}}; unsigned char out[][4] = {{0,0,0,255},{127,0,0,255},{0,127,0,255},{255,255,255,255}}; -- 2.30.2